﻿// ===============================================================================
// UrlPath.cs
// EOS Framework
// ===============================================================================
// Copyright (c) EOS Development Group. All rights reserved.
// ===============================================================================

namespace EOS.Framework.Web.Mvc
{
    using System.Web;
    using EOS.Framework.Tools;

    /// <summary>
    /// Manages a web url path.
    /// </summary>
    public static class UrlPath
    {
        public static string ToAbsolutPath(string url)
        {
            string newUrl = url;
            if (!StringHelper.IsEmptyOrBlanksOnly(url))
            {
                string appPath = HttpRuntime.AppDomainAppVirtualPath;
                if (!appPath.EndsWith("/"))
                {
                    appPath += "/";
                }

                newUrl = newUrl.Replace("~/", appPath);
            }

            return newUrl;
        }
    }
}
